<?php
session_start();

if( isset($_SERVER['SSL_CLIENT_VERIFY']) && $_SERVER['SSL_CLIENT_VERIFY'] == 'SUCCESS' ) {
	
	if( $_GET['auth'] == 1 ) {
		
	} else {
		$_SESSION['ID_CART_AUTH_DATA'] = $_SERVER['SSL_CLIENT_S_DN'];
	}
	
} else {
	
}



require_once '../location.php';
require_once ROOT_PATH . 'library/IdCard/IdCardAuthentication.php';
require_once ROOT_PATH . 'library/IdCard/IdCardUser.php';

$id = new IdCardAuthentication();
try {
	$idCardUser = $id->getUser();
} catch (AuthenticationException $e) {
	header('Location: /user/id-card-failed');
}
$_SESSION['idCardUser'] = serialize($idCardUser);

if (isset($_GET['auth'])) {
	header('Location: /user/id-card-authentication');	
} else {
	header('Location: /user/id-card-login');
}
?>